<template>
  <div class="init_main" v-if="!isloading">
    <div>
      模板名称：
      <el-input
        v-model="info.Template.Name"
        size="mini"
        style="width: 150px"
      ></el-input>
      <!-- 调查时间：
      <el-date-picker
        v-model="nowTime"
        
        value-format="yyyy-MM-dd HH:mm:ss"
        type="datetime"
        size="mini"
      >
      </el-date-picker> -->
      <!-- 调查人：
      <el-input
        v-model="info.调查人"
        size="mini"
        style="width: 150px"
      ></el-input> -->

      被调查护士：
      <el-input
        v-model="CheckedUsers"
        size="mini"
        style="width: 80px"
      ></el-input>
      最满意护士：
      <el-input
        v-model="MostSatisfiedNurseName"
        size="mini"
        style="width: 80px"
      ></el-input>
      最不满意护士：
      <el-input
        v-model="leastSatisfiedNurseName"
        size="mini"
        style="width: 80px"
      ></el-input>

      <p></p>
      患者姓名：
      <el-input
        v-model="PatientName"
        size="mini"
        style="width: 80px"
      ></el-input>
      性别：
      <el-input
        v-model="PatientGender"
        size="mini"
        style="width: 80px"
      ></el-input>
      年龄：
      <el-input
        v-model="PatientAge"
        type="number"
        size="mini"
        style="width: 80px"
      ></el-input>
      床号：
      <el-input
        v-model="PatientBedNo"
        size="mini"
        style="width: 80px"
      ></el-input>
      住院号：
      <el-input
        v-model="PatientInHospitalNo"
        size="mini"
        type="number"
        style="width: 80px"
      ></el-input>

      <p></p>
      <!-- 调查者：
      <el-input
        v-model="info.被调查者"
        size="mini"
        style="width: 80px"
      ></el-input> -->
      满分：
      <el-input
        v-model="info.Template.TotalScore"
        size="mini"
        style="width: 60px"
      ></el-input>
      得分：
      <el-input v-model="得分" size="mini" style="width: 60px"></el-input>
      <el-pagination
        :disabled="Sort || !btn_d"
        small
        layout="prev, pager, next"
        :total="total"
        :current-page.sync="page_now"
        :page-size="1"
        style="display: inline-block"
        @current-change="page_change"
      >
      </el-pagination>
      <!-- <el-button
        plain
        size="mini"
        icon="el-icon-delete"
        style="margin-left: 10px"
        type="warning"
        >清除</el-button
      > -->
      <!-- <el-button
        plain
        size="mini"
        icon="el-icon-circle-check"
        type="primary"
        @click="btn_ok2"
        :disabled="btn_d || !info.CanSave"
        >保存</el-button
      > -->
      <el-button
        plain
        size="mini"
        icon="el-icon-circle-check"
        type="primary"
        @click="btn_ok2"
        >保存</el-button
      >
      <el-button plain size="mini" icon="el-icon-back" @click="black_page"
        >返回</el-button
      >
    </div>
    <div class="table">
      <el-table
        :data="tableData"
        border
        style="width: 100%"
        height="642"
        :span-method="objectSpanMethod"
        v-if="istableShow"
      >
        <el-table-column prop="Content1" label="一级内容" align="center">
        </el-table-column>
        <el-table-column prop="Content2" label="二级内容" align="center">
        </el-table-column>
        <el-table-column prop="DeductionDetail" label="扣分细则" align="center">
        </el-table-column>
        <el-table-column prop="Score" label="分值" align="center">
        </el-table-column>
        <el-table-column prop="DeductScore" label="扣分" align="center">
          <template slot-scope="scope">
            <el-input
              v-model="scope.row.DeductScore"
              placeholder="请输入内容"
              size="mini"
              type="number"
              @change="sum_分数()"
            ></el-input>
          </template>
        </el-table-column>
        <el-table-column
          prop="Option"
          label="存在问题"
          align="center"
          width="500"
        >
          <template slot-scope="scope">
            <div v-if="scope.row.OptionGroupValues.length > 1">
              <div v-if="scope.row.DeductionWay == '主观填写'">
                <el-input
                  v-if="scope.row.Option == '填写类型'"
                  type="textarea"
                  :rows="4"
                  placeholder="请输入内容"
                  v-model="scope.row.Problem"
                >
                </el-input>
              </div>
              <div v-if="scope.row.DeductionWay == '选择类型'">
                <el-form :model="scope.row" :rules="rules" ref="ruleForm">
                  <el-form-item label=" " prop="Problem">
                    <el-radio-group
                      v-model="scope.row.Problem"
                      @change="
                        (scope.row.DeductScore = scope.row.Problem), sum_分数()
                      "
                    >
                      <template
                        v-for="(item, index) in scope.row.OptionGroupValues"
                      >
                        <el-radio :label="item.Point + ''" :key="index">{{
                          item.Name
                        }}</el-radio>
                      </template>
                    </el-radio-group>
                  </el-form-item>
                </el-form>
              </div>
            </div>
            <div v-else>
              <el-input
                v-if="scope.row.Option == '填写类型'"
                type="textarea"
                :rows="4"
                placeholder="请输入内容"
                v-model="scope.row.Problem"
              >
              </el-input>
              <el-radio-group
                v-model="scope.row.Problem"
                v-if="scope.row.Option == '满意类型'"
                @change="
                  (scope.row.DeductScore = scope.row.Problem), sum_分数()
                "
              >
                <el-radio label="0">很满意</el-radio>
                <el-radio label="1">满意</el-radio>
                <el-radio label="2">一般</el-radio>
                <el-radio label="3">不满意</el-radio>
                <el-radio label="4">很不满意</el-radio>
              </el-radio-group>
              <el-radio-group
                v-model="scope.row.Problem"
                v-if="scope.row.Option == '是否类型'"
                @change="
                  (scope.row.DeductScore = scope.row.Problem), sum_分数()
                "
              >
                <el-radio label="0">否</el-radio>
                <el-radio label="5">是</el-radio>
              </el-radio-group>
              <el-radio-group
                v-model="scope.row.Problem"
                v-if="scope.row.Option == '评分类型'"
                @change="
                  (scope.row.DeductScore = scope.row.Problem), sum_分数()
                "
              >
                <el-radio label="0">非常满意</el-radio>
                <el-radio label="1">满意</el-radio>
                <el-radio label="2">较满意</el-radio>
                <el-radio label="3">不满意</el-radio>
                <el-radio label="4">非常不满意</el-radio>
              </el-radio-group>
              <el-radio-group
                v-model="scope.row.Problem"
                v-if="scope.row.Option == '频次类型'"
                @change="
                  (scope.row.DeductScore = scope.row.Problem), sum_分数()
                "
              >
                <el-radio label="0">会</el-radio>
                <el-radio label="1">有时会，有时不会</el-radio>
                <el-radio label="5">完全不会</el-radio>
                <el-radio label="0.0">不需要该服务</el-radio>
              </el-radio-group>
              <el-radio-group
                v-model="scope.row.Problem"
                v-if="scope.row.Option == '熟练类型'"
                @change="
                  (scope.row.DeductScore = scope.row.Problem), sum_分数()
                "
              >
                <el-radio label="0">很熟练</el-radio>
                <el-radio label="1">还可以</el-radio>
                <el-radio label="5">不熟练</el-radio>
                <el-radio label="0.00">不需要该服务</el-radio>
              </el-radio-group>
              <el-radio-group
                v-model="scope.row.Problem"
                v-if="scope.row.Option == '普及类型'"
                @change="
                  (scope.row.DeductScore = scope.row.Problem), sum_分数()
                "
              >
                <el-radio label="0">主动讲过</el-radio>
                <el-radio label="1">询问后才讲</el-radio>
                <el-radio label="5">完全没有讲过</el-radio>
                <el-radio label="0.0">不需要该服务</el-radio>
              </el-radio-group>
              <el-radio-group
                v-model="scope.row.Problem"
                v-if="scope.row.Option == '安静类型'"
                @change="
                  (scope.row.DeductScore = scope.row.Problem), sum_分数()
                "
              >
                <el-radio label="0">（总是）很安静</el-radio>
                <el-radio label="1">（还可以），有时比较吵</el-radio>
                <el-radio label="5">（根本）不安静</el-radio>
              </el-radio-group>
              <el-radio-group
                v-model="scope.row.Problem"
                v-if="scope.row.Option == '干净类型'"
                @change="
                  (scope.row.DeductScore = scope.row.Problem), sum_分数()
                "
              >
                <el-radio label="0">是</el-radio>
                <el-radio label="1">有时会比较脏/有异味</el-radio>
              </el-radio-group>
              <el-radio-group
                v-model="scope.row.Problem"
                v-if="scope.row.Option == '知道类型'"
                @change="
                  (scope.row.DeductScore = scope.row.Problem), sum_分数()
                "
              >
                <el-radio label="0">知道</el-radio>
                <el-radio label="5">不知道</el-radio>
              </el-radio-group>
              <el-radio-group
                v-model="scope.row.Problem"
                v-if="scope.row.Option == '挂号方式'"
                @change="sum_分数()"
              >
                <el-radio label="A窗口挂号">A窗口挂号</el-radio>
                <el-radio label="B预约挂号（如电话、网络、微信等）"
                  >B预约挂号（如电话、网络、微信等）</el-radio
                >
                <el-radio label="C自助挂号机挂号">C自助挂号机挂号</el-radio>
                <el-radio label="D其他方式">D其他方式</el-radio>
              </el-radio-group>
              <el-radio-group
                v-model="scope.row.Problem"
                v-if="scope.row.Option == '是否方便'"
                @change="
                  (scope.row.DeductScore = scope.row.Problem), sum_分数()
                "
              >
                <el-radio label="3">A非常不方便</el-radio>
                <el-radio label="2">B不太方便</el-radio>
                <el-radio label="1">C比较方便</el-radio>
                <el-radio label="0">D非常方便</el-radio>
                <el-radio label="0.0">E不知道</el-radio>
              </el-radio-group>
              <el-radio-group
                v-model="scope.row.Problem"
                v-if="scope.row.Option == '是否尊重（挂号）'"
                @change="
                  (scope.row.DeductScore = scope.row.Problem), sum_分数()
                "
              >
                <el-radio label="3">A非常不尊重</el-radio>
                <el-radio label="2">B不太尊重 </el-radio>
                <el-radio label="1">C比较尊重 </el-radio>
                <el-radio label="0">D非常尊重 </el-radio>
                <el-radio label="0.0">E我没有接触过挂号服务人员 </el-radio>
              </el-radio-group>
              <el-radio-group
                v-model="scope.row.Problem"
                v-if="scope.row.Option == '是否仔细'"
                @change="
                  (scope.row.DeductScore = scope.row.Problem), sum_分数()
                "
              >
                <el-radio label="3">A非常不仔细 </el-radio>
                <el-radio label="2">B不太仔细 </el-radio>
                <el-radio label="1">C比较仔细 </el-radio>
                <el-radio label="0">D非常仔细 </el-radio>
              </el-radio-group>
              <el-radio-group
                v-model="scope.row.Problem"
                v-if="scope.row.Option == '是否尊重'"
                @change="
                  (scope.row.DeductScore = scope.row.Problem), sum_分数()
                "
              >
                <el-radio label="3">A非常不尊重 </el-radio>
                <el-radio label="2">B不太尊重 </el-radio>
                <el-radio label="1">C比较尊重 </el-radio>
                <el-radio label="0">D非常尊重 </el-radio>
              </el-radio-group>
              <el-radio-group
                v-model="scope.row.Problem"
                v-if="scope.row.Option == '是否听懂'"
                @change="
                  (scope.row.DeductScore = scope.row.Problem), sum_分数()
                "
              >
                <el-radio label="3">A完全听不懂 </el-radio>
                <el-radio label="2">B基本听不懂 </el-radio>
                <el-radio label="1">C基本能听懂 </el-radio>
                <el-radio label="0">D完全能听懂 </el-radio>
              </el-radio-group>
              <el-radio-group
                v-model="scope.row.Problem"
                v-if="scope.row.Option == '是否尊重（护士）'"
                @change="
                  (scope.row.DeductScore = scope.row.Problem), sum_分数()
                "
              >
                <el-radio label="3">A非常不尊重 </el-radio>
                <el-radio label="2">B不太尊重 </el-radio>
                <el-radio label="1">C比较尊重 </el-radio>
                <el-radio label="0">D非常尊重 </el-radio>
                <el-radio label="0.0">E我没有接触过护士 </el-radio>
              </el-radio-group>
              <el-radio-group
                v-model="scope.row.Problem"
                v-if="scope.row.Option == '是否明确'"
                @change="
                  (scope.row.DeductScore = scope.row.Problem), sum_分数()
                "
              >
                <el-radio label="3">A非常不明确 </el-radio>
                <el-radio label="2">B比较不明确 </el-radio>
                <el-radio label="1">C比较明确 </el-radio>
                <el-radio label="0">D非常明确 </el-radio>
              </el-radio-group>
              <el-radio-group
                v-model="scope.row.Problem"
                v-if="scope.row.Option == '是否满意'"
                @change="
                  (scope.row.DeductScore = scope.row.Problem), sum_分数()
                "
              >
                <el-radio label="3">A非常不满意 </el-radio>
                <el-radio label="2">B不太满意 </el-radio>
                <el-radio label="1">C比较满意 </el-radio>
                <el-radio label="0">D非常满意 </el-radio>
              </el-radio-group>
              <el-radio-group
                v-model="scope.row.Problem"
                v-if="scope.row.Option == '厕所是否清洁'"
                @change="
                  (scope.row.DeductScore = scope.row.Problem), sum_分数()
                "
              >
                <el-radio label="3">A非常不清洁 </el-radio>
                <el-radio label="2">B不太清洁 </el-radio>
                <el-radio label="1">C比较清洁 </el-radio>
                <el-radio label="0">D非常清洁 </el-radio>
                <el-radio label="0.0">E我没有使用过 </el-radio>
              </el-radio-group>
              <el-radio-group
                v-model="scope.row.Problem"
                v-if="scope.row.Option == '是否便利'"
                @change="
                  (scope.row.DeductScore = scope.row.Problem), sum_分数()
                "
              >
                <el-radio label="3">A非常不便利 </el-radio>
                <el-radio label="2">B不太便利 </el-radio>
                <el-radio label="1">C比较便利 </el-radio>
                <el-radio label="0">D非常便利 </el-radio>
              </el-radio-group>
              <el-radio-group
                v-model="scope.row.Problem"
                v-if="scope.row.Option == '是否注意'"
                @change="
                  (scope.row.DeductScore = scope.row.Problem), sum_分数()
                "
              >
                <el-radio label="3">A非常不注意 </el-radio>
                <el-radio label="2">B不太注意 </el-radio>
                <el-radio label="1">C比较注意 </el-radio>
                <el-radio label="0">D非常注意 </el-radio>
              </el-radio-group>
              <el-radio-group
                v-model="scope.row.Problem"
                v-if="scope.row.Option == '是否及时'"
                @change="
                  (scope.row.DeductScore = scope.row.Problem), sum_分数()
                "
              >
                <el-radio label="3">A非常不及时 </el-radio>
                <el-radio label="2">B不太及时 </el-radio>
                <el-radio label="1">C比较及时 </el-radio>
                <el-radio label="0">D非常及时 </el-radio>
                <el-radio label="0.0">E我没有抱怨或不满 </el-radio>
              </el-radio-group>
              <el-radio-group
                v-model="scope.row.Problem"
                v-if="scope.row.Option == '评分'"
                @change="
                  (scope.row.DeductScore = scope.row.Problem), sum_分数()
                "
              >
                <el-radio label="9">A1 </el-radio>
                <el-radio label="8">B2 </el-radio>
                <el-radio label="7">C3 </el-radio>
                <el-radio label="6">D4 </el-radio>
                <el-radio label="5">E5 </el-radio>
                <el-radio label="4">F6 </el-radio>
                <el-radio label="3">G7 </el-radio>
                <el-radio label="2">H8 </el-radio>
                <el-radio label="1">I9 </el-radio>
                <el-radio label="0">J10 </el-radio>
              </el-radio-group>
              <el-radio-group
                v-model="scope.row.Problem"
                v-if="scope.row.Option == '是否推荐'"
                @change="sum_分数()"
              >
                <el-radio label="A一定不会">A一定不会 </el-radio>
                <el-radio label="B基本不会">B基本不会 </el-radio>
                <el-radio label="C可能会">C可能会 </el-radio>
                <el-radio label="D一定会">D一定会 </el-radio>
              </el-radio-group>
              <el-radio-group
                v-model="scope.row.Problem"
                v-if="scope.row.Option == '性别类型'"
                @change="sum_分数()"
              >
                <el-radio label="A男">A男 </el-radio>
                <el-radio label="B女">B女 </el-radio>
              </el-radio-group>
              <el-radio-group
                v-model="scope.row.Problem"
                v-if="scope.row.Option == '年龄类型'"
                @change="sum_分数()"
              >
                <el-radio label="A20岁以下">A20岁以下 </el-radio>
                <el-radio label="B20-29岁">B20-29岁 </el-radio>
                <el-radio label="C30-39岁">C30-39岁 </el-radio>
                <el-radio label="D40-49岁">D40-49岁 </el-radio>
                <el-radio label="E50-59岁">E50-59岁 </el-radio>
                <el-radio label="F60岁以上">F60岁以上 </el-radio>
              </el-radio-group>
              <el-radio-group
                v-model="scope.row.Problem"
                v-if="scope.row.Option == '学历类型'"
                @change="sum_分数()"
              >
                <el-radio label="A初中及以下">A初中及以下 </el-radio>
                <el-radio label="B高中或中专">B高中或中专 </el-radio>
                <el-radio label="C本科或大专">C本科或大专 </el-radio>
                <el-radio label="D研究生">D研究生 </el-radio>
              </el-radio-group>
              <el-radio-group
                v-model="scope.row.Problem"
                v-if="scope.row.Option == '挂号类型'"
                @change="sum_分数()"
              >
                <el-radio label="A普通号">A普通号 </el-radio>
                <el-radio label="B非普通号（含专家号、特需门诊等）"
                  >B非普通号（含专家号、特需门诊等）
                </el-radio>
              </el-radio-group>
              <el-radio-group
                v-model="scope.row.Problem"
                v-if="scope.row.Option == '支付类型'"
                @change="sum_分数()"
              >
                <el-radio label="A个人自付">A个人自付 </el-radio>
                <el-radio label="B新农合">B新农合 </el-radio>
                <el-radio label="C城镇医疗保险（职工/居民）"
                  >C城镇医疗保险（职工/居民）
                </el-radio>
                <el-radio label="D公费医疗">D公费医疗 </el-radio>
              </el-radio-group>
              <el-radio-group
                v-model="scope.row.Problem"
                v-if="scope.row.Option == '是否如此'"
                @change="
                  (scope.row.DeductScore = scope.row.Problem), sum_分数()
                "
              >
                <el-radio label="3">A从未如此 </el-radio>
                <el-radio label="2">B有时如此 </el-radio>
                <el-radio label="1">C经常如此 </el-radio>
                <el-radio label="0">D总是如此 </el-radio>
              </el-radio-group>
              <el-radio-group
                v-model="scope.row.Problem"
                v-if="scope.row.Option == '护士是否如此'"
                @change="
                  (scope.row.DeductScore = scope.row.Problem), sum_分数()
                "
              >
                <el-radio label="3">A从未如此 </el-radio>
                <el-radio label="2">B有时如此 </el-radio>
                <el-radio label="1">C经常如此 </el-radio>
                <el-radio label="0">D总是如此 </el-radio>
                <el-radio label="0.0">E住院期间，我没按过呼叫铃 </el-radio>
              </el-radio-group>
              <el-radio-group
                v-model="scope.row.Problem"
                v-if="scope.row.Option == '提供帮助'"
                @change="sum_分数()"
              >
                <el-radio label="A亲友或病友">A亲友或病友 </el-radio>
                <el-radio label="B花钱请的护工">B花钱请的护工 </el-radio>
                <el-radio label="C医院的工作人员">C医院的工作人员 </el-radio>
                <el-radio label="D我无法得到帮助">D我无法得到帮助 </el-radio>
                <el-radio label="E我不需要别人帮助"
                  >E我不需要别人帮助
                </el-radio>
              </el-radio-group>
              <el-radio-group
                v-model="scope.row.Problem"
                v-if="scope.row.Option == '是否尽力'"
                @change="
                  (scope.row.DeductScore = scope.row.Problem), sum_分数()
                "
              >
                <el-radio label="3">A从未如此 </el-radio>
                <el-radio label="2">B有时如此 </el-radio>
                <el-radio label="1">C经常如此 </el-radio>
                <el-radio label="0">D总是如此 </el-radio>
                <el-radio label="0.0">E我没有出现过疼痛和难忍的情况 </el-radio>
              </el-radio-group>
              <el-radio-group
                v-model="scope.row.Problem"
                v-if="scope.row.Option == '是否如此2'"
                @change="
                  (scope.row.DeductScore = scope.row.Problem), sum_分数()
                "
              >
                <el-radio label="3">A从未如此 </el-radio>
                <el-radio label="2">B有时如此 </el-radio>
                <el-radio label="1">C经常如此 </el-radio>
                <el-radio label="0">D总是如此 </el-radio>
                <el-radio label="0.0">E我不知道 </el-radio>
              </el-radio-group>
              <el-radio-group
                v-model="scope.row.Problem"
                v-if="scope.row.Option == '是否满意（住院）'"
                @change="
                  (scope.row.DeductScore = scope.row.Problem), sum_分数()
                "
              >
                <el-radio label="3">A非常不满意 </el-radio>
                <el-radio label="2">B比较不满意 </el-radio>
                <el-radio label="1">C比较满意 </el-radio>
                <el-radio label="0">D非常满意 </el-radio>
                <el-radio label="0.0">E我不知道 </el-radio>
              </el-radio-group>
              <el-radio-group
                v-model="scope.row.Problem"
                v-if="scope.row.Option == '是否尊重亲友'"
                @change="
                  (scope.row.DeductScore = scope.row.Problem), sum_分数()
                "
              >
                <el-radio label="3">A非常不尊重 </el-radio>
                <el-radio label="2">B比较不尊重 </el-radio>
                <el-radio label="1">C比较尊重 </el-radio>
                <el-radio label="0">D非常尊重 </el-radio>
                <el-radio label="0.0">E我没有亲友来探视 </el-radio>
              </el-radio-group>
              <el-radio-group
                v-model="scope.row.Problem"
                v-if="scope.row.Option == '是否复杂'"
                @change="
                  (scope.row.DeductScore = scope.row.Problem), sum_分数()
                "
              >
                <el-radio label="3">A非常复杂 </el-radio>
                <el-radio label="2">B比较复杂 </el-radio>
                <el-radio label="1">C比较简单 </el-radio>
                <el-radio label="0">D非常简单 </el-radio>
              </el-radio-group>
              <el-radio-group
                v-model="scope.row.Problem"
                v-if="scope.row.Option == '是否类型'"
                @change="sum_分数()"
              >
                <el-radio label="A是">A是 </el-radio>
                <el-radio label="B否">B否 </el-radio>
              </el-radio-group>
              <el-radio-group
                v-model="scope.row.Problem"
                v-if="scope.row.Option == '是否清楚'"
                @change="
                  (scope.row.DeductScore = scope.row.Problem), sum_分数()
                "
              >
                <el-radio label="3">A完全不清楚 </el-radio>
                <el-radio label="2">B基本不清楚 </el-radio>
                <el-radio label="1">C基本清楚 </el-radio>
                <el-radio label="0">D完全清楚 </el-radio>
              </el-radio-group>
              <el-radio-group
                v-model="scope.row.Problem"
                v-if="scope.row.Option == '是否同意（正面）'"
                @change="
                  (scope.row.DeductScore = scope.row.Problem), sum_分数()
                "
              >
                <el-radio label="4">A非常不同意 </el-radio>
                <el-radio label="3">B比较不同意 </el-radio>
                <el-radio label="2">C一般 </el-radio>
                <el-radio label="1">D比较同意 </el-radio>
                <el-radio label="0">E非常同意 </el-radio>
              </el-radio-group>
              <el-radio-group
                v-model="scope.row.Problem"
                v-if="scope.row.Option == '是否同意（负面）'"
                @change="
                  (scope.row.DeductScore = scope.row.Problem), sum_分数()
                "
              >
                <el-radio label="0">A非常不同意 </el-radio>
                <el-radio label="1">B比较不同意 </el-radio>
                <el-radio label="2">C一般 </el-radio>
                <el-radio label="3">D比较同意 </el-radio>
                <el-radio label="4">E非常同意 </el-radio>
              </el-radio-group>
              <el-radio-group
                v-model="scope.row.Problem"
                v-if="scope.row.Option == '是否同意（不得分）'"
                @change="sum_分数()"
              >
                <el-radio label="A非常不同意">A非常不同意 </el-radio>
                <el-radio label="B比较不同意">B比较不同意 </el-radio>
                <el-radio label="C一般">C一般 </el-radio>
                <el-radio label="D比较同意">D比较同意 </el-radio>
                <el-radio label="E非常同意">E非常同意 </el-radio>
              </el-radio-group>
              <el-radio-group
                v-model="scope.row.Problem"
                v-if="scope.row.Option == '工作岗位'"
                @change="sum_分数()"
              >
                <el-radio label="A管理人员">A管理人员 </el-radio>
                <el-radio label="B医生">B医生 </el-radio>
                <el-radio label="C护士">C护士 </el-radio>
                <el-radio label="D药师">D药师 </el-radio>
                <el-radio label="E技师">E技师 </el-radio>
                <el-radio label="F后勤人员">F后勤人员 </el-radio>
                <el-radio label="G其他">G其他 </el-radio>
              </el-radio-group>
              <el-radio-group
                v-model="scope.row.Problem"
                v-if="scope.row.Option == '职称类型'"
                @change="sum_分数()"
              >
                <el-radio label="A无职称">A无职称 </el-radio>
                <el-radio label="B初职">B初职 </el-radio>
                <el-radio label="C中职">C中职 </el-radio>
                <el-radio label="D副高">D副高 </el-radio>
                <el-radio label="E正高">E正高 </el-radio>
              </el-radio-group>
            </div>
          </template>
        </el-table-column>
      </el-table>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      name: "",
      tableData: [],
      info: {
        Template: {
          Name: "",
        },
      },
      total: 0,
      page_now: this.$route.query.Sort ? this.$route.query.Sort * 1 : 1,
      istableShow: true,
      得分: 100,
      CheckedUsers: "",
      MostSatisfiedNurseName: "",
      leastSatisfiedNurseName: "",
      PatientName: "",
      PatientGender: "",
      PatientAge: "",
      PatientBedNo: "",
      PatientInHospitalNo: "",
      btn_d: this.$route.query.btn == 2 ? true : false,
      Sort: this.$route.query.Sort ? true : false,
      isloading: false,
      rules: {
        Problem: [{ required: true, message: "请输入", trigger: "change" }],
      },
    };
  },
  mounted() {
    this.name = this.$route.meta.title;
    this.getTable();
  },
  methods: {
    getTable() {
      this.isloading = true;
      this.$get("/Task/GetTaskInfoById/" + this.$route.query.taskDataId).then(
        (res) => {
          this.info = res.Data;
          this.setTableData();
          this.courseinit();
          this.setHand(0);
          if (this.$route.query.Sort) {
            this.page_change(this.$route.query.Sort * 1);
          }
          this.isloading = false;
        }
      );
    },
    setTableData() {
      var list = [];
      for (var i in this.info.TemplateDatas) {
        var item = this.info.TemplateDatas[i];
        // item.DeductScore = null;
        // item.Problem = null;
        list.push(item);
      }
      for (var i in this.info.TaskDatas) {
        if (this.info.TaskDatas[i].Details.length == 0) {
          this.info.TaskDatas[i].Details = list;
        }
      }
      this.tableData = this.info.TaskDatas[0].Details;
      console.log(this.tableData);
      this.sum_分数();
      this.total = this.info.TaskDatas.length;
      console.log(this.tableData);
    },
    setHand(val) {
      var info = this.info.TaskDatas[val].Data;
      this.CheckedUsers = info.CheckedUsers;
      this.MostSatisfiedNurseName = info.MostSatisfiedNurseName;
      this.leastSatisfiedNurseName = info.LeastSatisfiedNurseName;
      this.PatientName = info.PatientName;
      this.PatientGender = info.PatientGender;
      this.PatientAge = info.PatientAge;
      this.PatientBedNo = info.PatientBedNo;
      this.PatientInHospitalNo = info.PatientInHospitalNo;
      console.log(info);
    },
    page_change(val) {
      // this.istableShow = false;
      // var list = [];
      // for (var i in this.info.TemplateDatas) {
      //   var item = this.info.TemplateDatas[i];
      //   item.DeductScore = null;
      //   item.Problem = null;
      //   list.push(item);
      // }
      // this.tableData = list;
      this.tableData = this.info.TaskDatas[val - 1].Details;
      this.setHand(val - 1);
      this.sum_分数();
      // console.log(this.tableData);
      // this.得分 = 100;
      // this.istableShow = true;
    },
    page_change1(val) {
      this.istableShow = false;
      var list = [];
      for (var i in this.info.TemplateDatas) {
        var item = this.info.TemplateDatas[i];
        item.DeductScore = null;
        item.Problem = null;
        list.push(item);
      }
      this.tableData = list;
      this.tableData = this.info.TaskDatas[val - 1].Details;
      console.log(this.tableData);
      this.sum_分数();
      this.istableShow = true;
    },
    btn_ok2() {
      // this.$refs["ruleForm"].validate((valid) => {
      //   if (valid) {
      //     this.$refs["ruleForm"].resetFields();
      //     this.btn_ok();
      //   } else {
      //     this.$notify.error({
      //       title: "错误",
      //       message: "有必填项没有填写!",
      //     });
      //     return;
      //   }
      // });
      this.btn_ok();
    },
    btn_ok() {
      var body = {
        taskDataId: this.info.TaskDatas[this.page_now - 1].Data.Id,
        taskData: {
          isShow: true,
          taskDataId: this.info.Task.Id,
          surveyTime: new Date(),
          score: this.得分,
          CheckedUsers: this.CheckedUsers,
          MostSatisfiedNurseName: this.MostSatisfiedNurseName,
          leastSatisfiedNurseName: this.leastSatisfiedNurseName,
          PatientName: this.PatientName,
          PatientGender: this.PatientGender,
          PatientAge: this.PatientAge,
          PatientBedNo: this.PatientBedNo,
          PatientInHospitalNo: this.PatientInHospitalNo,
        },
        taskDataDetails: this.tableData,
      };
      this.CheckedUsers = "";
      this.MostSatisfiedNurseName = "";
      this.leastSatisfiedNurseName = "";
      this.PatientName = "";
      this.PatientGender = "";
      this.PatientAge = "";
      this.PatientBedNo = "";
      this.PatientInHospitalNo = "";

      this.$post("/Task/SaveTaskData", body).then((res) => {
        if (this.page_now == this.info.TaskDatas.length) {
          this.返回上一页();
          return;
        }
        this.page_now = this.page_now + 1;
        this.page_change1(this.page_now);
      });
    },
    返回上一页() {
      this.$confirm("问卷已全部作答完毕，是否返回上一页?", "提示", {
        confirmButtonText: "是",
        cancelButtonText: "否",
        type: "warning",
      })
        .then(() => {
          var body = this.info.Task;
          body.Status = 30;
          this.$put("/Task/UpdateOneStatus", body).then((res) => {
            this.black_page();
          });
        })
        .catch(() => {
          var body = this.info.Task;
          body.Status = 30;
          this.$put("/Task/UpdateOneStatus", body).then((res) => {
            this.black_page();
          });
          return;
        });
    },
    sum_分数() {
      this.得分 = this.info.Template.TotalScore;
      for (var i in this.tableData) {
        var um = Number(this.tableData[i].DeductScore);
        var that = this;
        if (!isNaN(um)) {
          that.得分 -= that.tableData[i].DeductScore
            ? that.tableData[i].DeductScore
            : "0";
        }
      }
    },
    // 领域合并
    courseinit() {
      // 首先初始化
      var _this = this;
      this.courseArr = [];
      this.coursePos = 0;
      for (var i = 0; i < _this.tableData.length; i++) {
        //判断是否是第一行
        if (i === 0) {
          //导入第一行数据
          _this.courseArr.push(1);
          _this.coursePos = 0;
        } else {
          //不是第一行时，就根据标识去存储，course为我第一行的prop属性的值
          if (_this.tableData[i].Content1 === _this.tableData[i - 1].Content1) {
            // 查找到下一行的数据等于上一行的数据时每次要把之前存储的数据+1
            _this.courseArr[_this.coursePos] += 1;
            _this.courseArr.push(0);
          } else {
            // 没有相同的数据时候，要记住当前的index
            _this.courseArr.push(1);
            _this.coursePos = i;
          }
        }
      }
    },
    //然后开始写组件自带的方法，
    objectSpanMethod({ row, column, rowIndex, columnIndex }) {
      if (columnIndex === 0) {
        const row1 = this.courseArr[rowIndex];
        const col1 = row1 > 0 ? 1 : 0;
        return {
          rowspan: row1,
          colspan: col1,
        };
      }
    },
    black_page() {
      this.$router.go(-1);
    },
  },
};
</script>

<style scoped lang='scss'>
.init_main {
  background-color: #fff;
  height: calc(100vh - 60px);
  border: 1px solid #333;
  border-radius: 5px;
  margin: 5px;
  padding: 10px;
  .name_sty {
    color: #000;
    font-weight: 700;
    font-size: 18px;
    font-family: "FangSong";
    border-bottom: 1px solid #333;
    padding-bottom: 5px;
  }
  .table {
    margin-top: 10px;
  }
}
::v-deep .el-pager li.active {
  color: #409eff !important;
  cursor: default;
}
</style>